package com.benshou.bsoa.controller.dingding;

/*
 * 考勤数据相关API接口、
 * 2025-04-27
 */

import com.benshou.bsoa.common.dto.ResponseVo;
import com.benshou.bsoa.dto.dingding.Attend;
import com.benshou.bsoa.service.dingding.AttendService;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 考勤数据相关API接口
 * @auth hyh
 * @date 2025/04/28
 */

@RestController
@RequestMapping("/api/v1/dingding")
public class AttendanceController {

    @Autowired
    private AttendService attendService;

    /**
     * 获取考勤数据的统计
     * @Param attend
     * 2025-04-27
     */
    @PostMapping("/data")
    public ResponseVo<Object> getAttendanceData(@RequestBody @Valid Attend attend) {
        try {
            return ResponseVo.success(attendService.getAttendanceData(attend));
        } catch (Exception e) {
            e.printStackTrace();
            return ResponseVo.fail("获取考勤数据失败");
        }
    }

}
